package com.tengniu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tengniu.buss.domain.MassageChair;
import com.tengniu.buss.service.MassageChairService;
import com.tengniu.service.MassageChairAdminService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Slf4j
@Service
public class MassageChairAdminServiceImpl implements MassageChairAdminService {

    @Resource
    private MassageChairService massageChairService;

    /**
     * 检查是否已经有投放按摩椅
     * @param pointId
     * @return
     */
    @Override
    public boolean checkPoint(Long pointId) {
        LambdaQueryWrapper<MassageChair> lambdaQueryWrapper = Wrappers.lambdaQuery(MassageChair.class)
                .eq(MassageChair::getPointId, pointId);
        int count = massageChairService.count(lambdaQueryWrapper);
        return count > 0;
    }
}
